| Python3Script Xojo Plugin |
|
Python3Script.SetPythonPath Method
Sets alternate path where to look for Python.
shared SetPythonPath(
path
as FolderItem)
Parameters
- path
- The full path to the actual Python 3.4.x or 3.5.x library.
Remarks
This method can only be set before calling Python3Script.Init after that time then this method will do nothing.
When setting the path it expects the full path to the actual Library as shown in the example bellow.
Note that if pointing to something that is not compatible, such as DLL that is not Python, DLL that is not one of the supported versions, 64 bit DLL from 32 bit application and other such will most likely result in crash.
Example:
Dim customPython as FolderItem
#if TargetMacOS
customPython = GetFolderItem("/Users/bjorneiriksson/anaconda/lib/libpython3.5m.dylib", FolderItem.PathTypeNative)
#elseif TargetWindows
customPython = GetFolderItem("C:\Anaconda3\python35.dll", FolderItem.PathTypeNative)
#else
customPython = GetFolderItem("/home/bjorneiriksson/anaconda3/lib/libpython3.5m.so", FolderItem.PathTypeNative)
#endif
if customPython = nil or not customPython.Exists then
MsgBox "Could not find custom path, will try default installation"
elseif customPython.Exists then
Python3Script.SetPythonPath(customPython)
If not Python3Script.PythonIsFound() then
MsgBox "Could load custom path, will try default installation"
Python3Script.SetPythonPath(nil)
end if
end if
If not Python3Script.PythonIsFound() then
MsgBox "Correct Python installation was not found on this machine"
Quit()
else
Python3Script.Init("TestApp")
end if
See Also
Python3Script Class